<%@page import="org.jeecgframework.web.util.StaticValue"%>
<%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<!DOCTYPE html>
<html>
<head>
<title>设备以及备件信息</title>
<t:base type="jquery,easyui,tools,DatePicker"></t:base>
<script type="text/javascript" src="plug-in/ckfinder/ckfinder.js"></script>
<script type="text/javascript">
$(function(){
	showChooseRoomBtns(false);
	$("#belongCinemaId_easyuiClear").click(function(){
		showChooseRoomBtns(false);
		$("#belongCinemaId").val("");
		$("#name").val("");
		$("#houseId").val("");
		$("#roomNum").val("");
		cinemaId == undefined;
	});
<%--	setTimeout(function(){--%>
<%--		$("#bpNo").siblings(".combo").find(".combo-text").attr({"datatype":"*","nullmsg":"请选择所属机构"});--%>
<%--		$("#cityId").siblings(".combo").find(".combo-text").attr({"datatype":"*","nullmsg":"请选择省市"});--%>
<%--	},1000);--%>
	if($("input[name='isNormal']:checked").val() == '<%=StaticValue.DIC_TRUE_OR_FALSE_NUM_0%>'){
		$("textarea[name='exceptionReason']").attr("disabled","disabled");
	}
	$("input[name='isNormal']").change(function(){
		if($(this).val() == "0"){
			$("textarea[name='exceptionReason']").attr({"disabled":"disabled"}).removeAttr("datatype");
		}else{
			$("textarea[name='exceptionReason']").removeAttr("disabled").attr({"datatype":"*","nullmsg":"请填写异常原因"});
		}
	});
});
function showChooseRoomBtns(show){
	if(show){
		$("#houseId_easyuiChoose").show();
		$("#houseId_easyuiClear").show();
	}else{
		$("#houseId_easyuiChoose").hide();
		$("#houseId_easyuiClear").hide();
		$("#houseId").blur();
	}
}
var cinemaId;
function cinemaChooseBack(){
	var curCinemaId = $("#belongCinemaId").val();
	if(curCinemaId == cinemaId || cinemaId == undefined){
		showChooseRoomBtns(true);
	}else if(curCinemaId == ""){
		showChooseRoomBtns(false);
	}else if(curCinemaId != cinemaId){
		$("#roomNum").val("");
		$("#houseId").val("");
	}
	cinemaId = curCinemaId;
}
function beforeSubmit(){
	var flag = true;
	var repairEndDateVal = $("#repairEndDate").val();//保修截止日期
	var installDateVal = $("#installDate").val();//安装日期
	var sendDateVal = $("#sendDate").val();//发货日期
	var repairEndDateArr = repairEndDateVal.split("-");
	var installDateArr = installDateVal.split("-");
	var sendDateArr = sendDateVal.split("-");
	var repairEndDate = new Date(repairEndDateArr[0],repairEndDateArr[1],repairEndDateArr[2]);
	var installDate = new Date(installDateArr[0],installDateArr[1],installDateArr[2]);
	var sendDate = new Date(sendDateArr[0],sendDateArr[1],sendDateArr[2]);
	if(repairEndDate < sendDate){
		flag = false;
		tip("保修截止日期早于发货日期");
	}
	if(installDate < sendDate){
		flag = false;
		tip("安装日期早于发货日期");
	}
	
	return flag;
}
</script>
</head>
<body>
<t:formvalid formid="formobj" dialog="true" usePlugin="password" layout="table" action="zyEquipmentSpareController.do?doAdd" tiptype="3" beforeSubmit="beforeSubmit">
	<input id="id" name="id" type="hidden" value="${zyEquipmentSparePage.id }">
	<table style="" cellpadding="0" cellspacing="1" class="formtable">
		<tr>
			<td align="right" style="width: 100px;">
				<label class="Validform_label">
					序列号SN:
				</label>
			</td>
			<td class="value" style="width: 420px;">
				<input id="sn" name="sn" type="text" style="width: 150px" class="inputxt" datatype="*" ajaxurl="zyEquipmentSpareController.do?checkSnUnique"/>
			</td>
			<td align="right" style="width: 100px;">
				<label class="Validform_label">
					服务状态:
				</label>
			</td>
			<td class="value" style="width: 420px;">
				<t:dictSelect field="serverState" type="select" typeGroupCode="<%=StaticValue.DIC_SERVER_STATE %>" hasPleaseSelect="false" />
			</td>
<%--			<td align="right" style="width: 110px;">--%>
<%--				<label class="Validform_label">--%>
<%--					商务合作对象编号:--%>
<%--				</label>--%>
<%--			</td>--%>
<%--			<td class="value" style="width: 310px;">--%>
<%--				<input id="bpNo" name="bpNo" type="text" style="width: 150px" class="inputxt" />--%>
<%--			</td>--%>
		</tr>
		<tr>
			<td align="right">
				<label class="Validform_label">
					机型:
				</label>
			</td>
			<td class="value">
				<input id="typeId" name="type.id" type="hidden" />
				<input id="typeName" type="text" readonly="readonly" style="width: 150px" class="inputxt" datatype="*" nullmsg="请选择机型 "/>
				<t:choose hiddenName="typeId" hiddenid="id" inputTextname="typeName" textname="text"  
					title="机型" url="zyEquipmentTypeController.do?goChooseEquipmentTypeForEquipment" name="zyEquipmentTypeList" width="600px" height="600px"
					icon="icon-search"  isclear="true" />
			</td>
			<td align="right">
				<label class="Validform_label">
					Item:
				</label>
			</td>
			<td class="value">
				<input id="item" name="item" type="text" style="width: 150px" class="inputxt" />
			</td>
		</tr>
		<tr>
			<td align="right">
				<label class="Validform_label">
					所属影院:
				</label>
			</td>
			<td class="value">
				<input name="zyCinema.id" type="hidden" id="belongCinemaId" >
                <input class="inputxt" id="name" readonly="readonly" style="width:260px;" />
                <t:choose hiddenName="belongCinemaId" hiddenid="id" url="zyCinemaController.do?zyChooseCinemasForEs" name="cinemaList" fun="cinemaChooseBack"
                          icon="icon-search" title="影院列表" textname="name" isclear="true" height="500px" />
			</td>
			<td align="right">
				<label class="Validform_label">
					放映厅:
				</label>
			</td>
			<td class="value">
				<input name="house.id" type="hidden" id="houseId">
                <input class="inputxt" id="roomNum" readonly="readonly" />
                <t:choose hiddenName="houseId" hiddenid="id" url="zyRoomController.do?zyChooseRoomForEquipment" name="zyRoomList" paramIds="belongCinemaId"
                          icon="icon-search" title="影厅列表" textname="roomNum" isclear="true" height="500px" />
			</td>
		</tr>
		<tr>
<%--			<td align="right">--%>
<%--				<label class="Validform_label">--%>
<%--					省市:--%>
<%--				</label>--%>
<%--			</td>--%>
<%--			<td class="value">--%>
<%--				<input id="tsTerritoryId" name="tsTerritory.id" type="hidden" />--%>
<%--				<input id="tsTerritoryName" type="text" readonly="readonly" style="width: 150px" class="inputxt" datatype="*" nullmsg="请选择市 "/>--%>
<%--				<t:choose hiddenName="tsTerritoryId" hiddenid="id" inputTextname="tsTerritoryName" textname="text"  --%>
<%--					title="机型" url="territoryController.do?goChooseTerritoryForEs" name="chooseTerritoryList" width="600px" height="600px"--%>
<%--					icon="icon-search"  isclear="true" />--%>
<%--			</td>--%>
			<td align="right">
				<label class="Validform_label">
					所有方式:
				</label>
			</td>
			<td class="value">
				<t:dictSelect field="ownWay" type="select" typeGroupCode="<%=StaticValue.DIC_OWN_WAY %>" defaultVal="<%=StaticValue.DIC_OWN_WAY_ONESELF %>"/>
			</td>
			<td align="right">
				<label class="Validform_label">
					所属机构:
				</label>
			</td>
			<td class="value">
				<t:comboTree url="departController.do?getOrgTree" name="tsDepart.id" id="belongOrg" multiple="false" width="280" />
			</td>
		</tr>
		<!-- <tr>
			<td align="right">
				<label class="Validform_label">
					去年巡检日期:
				</label>
			</td>
			<td class="value">
				<input id="lastYearInspectionDate" class="Wdate" onClick="WdatePicker()" name="lastYearInspectionDate" type="text" style="width: 150px" class="inputxt" />
			</td>
			<td align="right"></td>
			<td class="value"></td>
		</tr> -->
		<tr>
			<td align="right">
				<label class="Validform_label">
					发货日期:
				</label>
			</td>
			<td class="value">
				<input id="sendDate" class="Wdate" onClick="WdatePicker()" name="sendDate" type="text" style="width: 150px" class="inputxt" datatype="*" nullmsg="请选择发货日期 " />
			</td>
			<td align="right">
				<label class="Validform_label">
					安装日期:
				</label>
			</td>
			<td class="value">
				<input id="installDate" class="Wdate" onClick="WdatePicker({minDate:'#F{$dp.$D(\'sendDate\')}'})" name="installDate" type="text" style="width: 150px" class="inputxt" />
			</td>
		</tr>
		<tr>
			<td align="right">
				<label class="Validform_label">
					保修开始日期:
				</label>
			</td>
			<td class="value">
				<input id="warrantyBeginDate" class="Wdate" onClick="WdatePicker({minDate:'#F{$dp.$D(\'sendDate\')}'})" name="warrantyBeginDate" type="text" style="width: 150px" datatype="*" nullmsg="请选择保修开始日期 " class="inputxt" />
				<span class="Validform_checktip"></span>
				<label class="Validform_label" style="display: none;">保修开始日期</label>
			</td>
			<td align="right">
				<label class="Validform_label">
					保修截止日期:
				</label>
			</td>
			<td class="value">
				<input id="repairEndDate" class="Wdate" onClick="WdatePicker({minDate:'#F{$dp.$D(\'sendDate\')}'})" name="repairEndDate" type="text" style="width: 150px" class="inputxt" datatype="*" nullmsg="请选择保修截止日期"/>
			</td>
		</tr>
		<tr>
			<td align="right">
				<label class="Validform_label">
					是否异常:
				</label>
			</td>
			<td class="value">
				<t:dictSelect field="isNormal" type="radio" typeGroupCode="<%=StaticValue.DIC_TRUE_OR_FALSE_NUM %>" defaultVal="<%=StaticValue.DIC_TRUE_OR_FALSE_NUM_0 %>" />
			</td>
			<td align="right">
				<label class="Validform_label">
					激光改造:
				</label>
			</td>
			<td class="value">
				<t:dictSelect field="laserReconstruction" type="radio" typeGroupCode="<%=StaticValue.DIC_TRUE_OR_FALSE_NUM %>" defaultVal="<%=StaticValue.DIC_TRUE_OR_FALSE_NUM_0 %>" />
			</td>
		</tr>
		<tr>
			<td align="right">
				<label class="Validform_label">
					续保方:
				</label>
			</td>
			<td class="value">
				<input id="companyOfRenewal" name="companyOfRenewal" type="text" style="width: 150px" class="inputxt" />
			</td>
			<td align="right">
				<label class="Validform_label">
					保修期(年):
				</label>
			</td>
			<td class="value">
				<input id="repairDate" name="repairDate" type="text" style="width: 150px" class="inputxt" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')"/>
				<span class="Validform_checktip"></span>
				<label class="Validform_label" style="display: none;">保修期</label>
			</td>
		</tr>
		<tr>
			<td align="right">
				<label class="Validform_label">
					异常原因:
				</label>
			</td>
			<td class="value">
				<textarea id="exceptionReason" name="exceptionReason" style="width: 150px" class="inputxt"></textarea>
				<span class="Validform_checktip"></span>
				<label class="Validform_label" style="display: none;">异常原因</label>
			</td>
			<td align="right">
				<label class="Validform_label">
					备注:
				</label>
			</td>
			<td class="value">
				<textarea id="remarks" name="remarks" style="width: 150px" class="inputxt"></textarea>
			</td>
		</tr>
		<tr>
			<td align="right">
				<label class="Validform_label">
					派单指示:
				</label>
			</td>
			<td class="value">
				<input id="sendSignId" name="sendSign.id" type="hidden" style="width: 150px" class="inputxt" />
				<input id="sendSignName" name="sendSignName" type="text" style="width: 150px" class="inputxt" />
				<t:choose hiddenName="sendSignId" hiddenid="id" textname="shortname" inputTextname="sendSignName"
							url="zyEquipmentSpareController.do?zyChooseOrgsForEs" name="orgList" 
                			icon="icon-search" title="机构列表" isclear="true"></t:choose>
			</td>
			<td align="right">
				<label class="Validform_label">
					院线:
				</label>
			</td>
			<td class="value">
			    <input id="intheaterId_3" type="hidden">
				<input id="cinema" name="cinema" type="text" style="width: 150px" class="inputxt" />
				<t:choose hiddenName="intheaterId_3" hiddenid="id" inputTextname="cinema"
                                  url="zyIntheaterController.do?zyintheatersList"
                                  name="intheaterList" icon="icon-search" title="院线列表" textname="typename"
                                  isclear="true" height="300px" width="400px"/>
			</td>
		</tr>
		<tr>
			<td align="right">
				<label class="Validform_label">
					是否序列号追踪:
				</label>
			</td>
			<td class="value">
				<t:dictSelect field="isSerialnumTrack" type="radio" typeGroupCode="<%=StaticValue.DIC_TRUE_OR_FALSE_NUM %>" defaultVal="<%=StaticValue.DIC_TRUE_OR_FALSE_NUM_0 %>" />
			</td>
			<td align="right">
				<label class="Validform_label">
					激光改造类型:
				</label>
			</td>
			<td class="value">
				<t:dictSelect field="laserReconstructionType" type="select" typeGroupCode="<%=StaticValue.lRST %>" defaultVal="<%=StaticValue.lRST2 %>" />
			</td>
		</tr>
	</table>
</t:formvalid>
</body>
<script src = "webpage/com/zybk/zy_equipment_spare/zyEquipmentSpare.js"></script>		